package com.lee.app.controller;

import com.lee.app.entity.Role;
import com.lee.app.service.RoleService;
import com.lee.app.util.JacksonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Lee
 */
@RestController
@RequestMapping("api/role")
public class RoleController {


    @Autowired
    private RoleService roleService;

    @RequestMapping("list")
    public String list() {
        List<Role> roles = roleService.list();
        if (roles != null) {
            return JacksonUtil.build(roles);
        } else {
            return JacksonUtil.build(0, "查询失败");
        }
    }
}
